import openpyxl

def readExcel(path):
    """read excel data and save to MySQL"""
    # 实例化一个wordbook
    workbook = openpyxl.load_workbook(path)
    # 读取sheet
    sheet = workbook['Sheet1']
    # 存储数据
    data_list = []
    # 遍历excel数据存储到列表中，每一行单独作为一个字典数组
    keys=['SName','Gender','Birthday','Mobile','Email','Address']
    for row in sheet.rows:
        #         定义临时字典
        temp_dict ={}
        for index,cell in enumerate(row):
            if index <=len(keys):
                temp_dict[keys[index]]= cell.value
            else:
                print('超出读取范围')
                pass
        data_list.append(temp_dict)

    return data_list
